<script>
    $(document).ready(function () {
        $(".page-header").html("<h1>Sportlaste lehekülg</h1>");
        
    });

</script>


<style>
    
    input, button {
        margin-right: 5px;
    }
    
    ul.pagination {
        margin: 10px 0px;
    }
    
</style>

<?php echo form_open('athletes/search', array('class' => 'form-inline')); ?>
<div class="form-group">
    <label class="sr-only" for="inputFname">Eesnimi</label>
    <input class="form-control" type="text" name="fname" id="fname" placeholder="Eesnimi" value="<?php echo isset($_GET['fname']) ? $_GET['fname'] : ''; ?>">
</div>
<div class="form-group">
    <label class="sr-only" for="inputFname">Perenimi</label>
    <input class="form-control" type="text" name="lname" id="lname" placeholder="Perenimi" value="<?php echo isset($_GET['lname']) ? $_GET['lname'] : ''; ?>">
</div>
<button type="submit" class="btn btn-default">Otsi</button>

<div class="form-group count">
    <?php echo "Kokku leiti <b>$count </b>sportlast."; ?>
</div>

</from>

<div class="clear-fix" ></div>

<?php if (strlen($pagination)): ?>
    <?php echo $pagination; ?>
<?php endif; ?>
<table class="table table-hover">
    <thead>
        <tr>
            <th>#</th>
            <th>Eesnimi</th>
            <th>Perenimi</th>
            <th>Sünniaeg</th>
            <th>Sugu</th>
            <th>Klubi</th>
        </tr>
    </thead>
    <tbody>

        <?php
        $i = $offset + 1;
        foreach ($athletes as /* @var $athlete Athlete */ $athlete) {
            echo '<tr onclick="document.location = \'' . site_url("athletes/profile/{$athlete->getID()}'") . '">';
            echo '<td>' . $i . '</td>';
            echo '<td>' . $athlete->getFirstName() . '</td>';
            echo '<td>' . $athlete->getLastName() . '</td>';
            echo '<td>' . $athlete->getDob() . '</td>';
            echo '<td>' . $athlete->getGender() . '</td>';
            echo '<td>' . $athlete->getTeam()->getFullName() . '</td>';
            echo '</tr>';
            $i++;
        }
        ?>
    </tbody>
</table>

<?php if (strlen($pagination)): ?>
    <?php echo $pagination; ?> 
<?php endif; ?>

